<?php if ( ! defined('BASEPATH')) exit('No direct script schess allowed'); ?>

<?=form_hidden("ID", $this->input->post("ID"))?>
<?=form_hidden("ENTITY", $this->input->post("ENTITY"))?>

<div class="form-group">
	<?=form_label($this->lang->line("SCHOLARSHIP_NAME"), "sch_name", array("class" => "control-label"))?>
	<?=form_input("sch_name", (isset($getScholarship[0]["schName"]) ? $getScholarship[0]["schName"] : null), "placeholder=\"".$this->lang->line("SCHOLARSHIP_NAME")."\" class=\"form-control\" id=\"sch_name\"")?>
</div>

<div class="form-group">
	<?=form_label($this->lang->line("LIST_BY"), "maj_name", array("class" => "control-label"))?>
	<div class="input-group">
		<?=form_input("sch_list_date", (isset($getScholarship[0]["schListDate"]) ? Common::dateFromDatabase($getScholarship[0]["schListDate"]) : null), "placeholder=\"mm.dd.yyyy\" class=\"form-control\" id=\"sch_list_date\"")?>
		<span class="input-group-addon" style="cursor:pointer"><span onclick="$('input[name=sch_list_date]').focus()" class="glyphicon glyphicon-calendar"></span></span>
	</div>

	<script>
		$(function() {
			var from = $('#sch_list_date').datepicker({
				format: 'mm.dd.yyyy'
			}).on('changeDate', function(e) {
				$(this).datepicker('hide');
			}).keydown(function() {
				$this = $(this);
				setTimeout(function () {
					if (!$this.is(':focus')) {
						$this.datepicker("hide");
					}
				}, 250);
			}).data('datepicker');
		});
	</script>

</div>

<div class="form-group">
	<?=form_label($this->lang->line("TO_THE_INSTITUTE"), "ins_id", array("class" => "control-label"))?>
	<?=form_dropdown("ins_id[]", $getInstituteList, (isset($getScholarship[0]["insList"]) ? explode(",", $getScholarship[0]["insList"]) : null), "id=\"ins_id\" style=\"width: 100%;\" multiple")?>
	<script>
		$(function() {
			$('#ins_id').select2();
		});
	</script>
</div>

<div class="form-group">
	<?=form_label($this->lang->line("TO_THE_MAJOR"), "maj_id", array("class" => "control-label"))?>
	<?=form_dropdown("maj_id[]", $getMajorList, (isset($getScholarship[0]["majList"]) ? explode(",", $getScholarship[0]["majList"]) : null), "id=\"maj_id\" style=\"width: 100%;\" multiple")?>
	<script>
		$(function() {
			$('#maj_id').select2();
		});
	</script>
</div>

<div class="form-group">
	<?=form_label($this->lang->line("CANDIDATE_MUST_BE_FROM"), "cou_id", array("class" => "control-label"))?>
	<?=form_dropdown("cou_id[]", $getCountryList, (isset($getScholarship[0]["couList"]) ? explode(",", $getScholarship[0]["couList"]) : null), "id=\"cou_id\" style=\"width: 100%;\" multiple")?>
	<script>
		$(function() {
			$('#cou_id').select2();
		});
	</script>
</div>

<div class="form-group">
	<?=form_label($this->lang->line("STUDYING"), "sch_sub_id", array("class" => "control-label"))?>
	<select id="sch_sub_id" name="sch_sub_id" style="width:100%;">
		<? 
		foreach($getSubjectList as $par) {
			echo	"<optgroup label=\"".$par["subName"]."\">";
			foreach($par["children"] as $child) {
				echo		"<option value=\"".$child["subId"]."\">".$child["subName"]."</option>";
			}
			echo	"</optgroup>";
		}
		?>
	</select>
	<script>
		$(function() {
			$('#sch_sub_id').select2();
		});
	</script>
</div>

<?=Common::generateForm($getCategoryVal)?>